The previous commit here changed things so that we do mkdir(x, 0700),
then fchmod later only if we created the directory.
However the logic was incorrect; we still need to chmod even in
MODE_USER if we created the directory.
/* We do fchmod/fchown last so that no one else could access the
* partially created directory and change content we're laying out.
*/
- if (!did_exist && mode != OSTREE_REPO_CHECKOUT_MODE_USER)
+ if (!did_exist)
{
do
res = fchmod (destination_dfd,
ot_util_set_error_from_errno (error, errno);
goto out;
}
+ }
+ if (!did_exist && mode != OSTREE_REPO_CHECKOUT_MODE_USER)
+ {
do
res = fchown (destination_dfd,
g_file_info_get_attribute_uint32 (source_info, "unix::uid"),